package com.zxhhyj.tag.ui.screen.home

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.Icon
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Add
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.zxhhyj.ui.theme.LocalColorScheme
import com.zxhhyj.ui.view.AppIconButton
import com.zxhhyj.ui.view.AppScaffold
import com.zxhhyj.ui.view.AppTopBar
import kotlinx.coroutines.launch
import selectFile

@Composable
fun HomeScreen() {
    val coroutineScope = rememberCoroutineScope()
    Row(modifier = Modifier.fillMaxSize()) {
        AppScaffold(
            modifier = Modifier.fillMaxHeight().width(300.dp)
                .background(color = LocalColorScheme.current.background),
            topBar = {
                AppTopBar(
                    title = {
                        Text(text = "StarTag", modifier = Modifier)
                    },
                    actions = {
                        AppIconButton(onClick = {
                            coroutineScope.launch {
                                selectFile()
                            }
                        }) {
                            Icon(Icons.Rounded.Add, null)
                        }
                    })
            }) {
            LazyColumn(
                modifier = Modifier.fillMaxSize(),
                contentPadding = it
            ) {

            }
        }
        Box(
            modifier = Modifier
                .background(LocalColorScheme.current.highBackground)
                .fillMaxHeight()
                .weight(1.0f)
        )
    }
}